/*
 * @Description:
 * @FilePath: /stm32f4_library/USER/bsp/adc.h
 * @Author: Wei Zhou
 * @Github: https://github.com/zromyk
 * @Date: 2021-04-28 15:25:19
 * @LastEditors: Wei Zhou
 * @LastEditTime: 2021-09-05 13:29:25
 * @Copyright: Copyright  2017 muyiro. All rights reserved.
 */

#ifndef ADC_INIT_H
#define ADC_INIT_H

#include "my_include.h"
#include "gpio.h"

/*
| channel | ADC1 | ADC2 | ADC3       |
| ------- | ---- | ---- | ---------- |
| 0       | PA0  | PA0  | PA0        |
| 1       | PA1  | PA1  | PA1        |
| 2       | PA2  | PA2  | PA2        |
| 3       | PA3  | PA3  | PA3        |
| 4       | PA4  | PA4  | ** PF6 **  |
| 5       | PA5  | PA5  | ** PF7 **  |
| 6       | PA6  | PA6  | ** PF8 **  |
| 7       | PA7  | PA7  | ** PF9 **  |
| 8       | PB0  | PB0  | ** PF10 *  |
| 9       | PB1  | PB1  | ** PF3 **  |
| 10      | PC0  | PC0  | PC0        |
| 11      | PC1  | PC1  | PC1        |
| 12      | PC2  | PC2  | PC2        |
| 13      | PC3  | PC3  | PC3        |
| 14      | PC4  | PC4  | ** PF4 **  |
| 15      | PC5  | PC5  | ** PF5 **  |
*/

/**
 * @brief  ADC initialize.
 * @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
 * @param  pin: Select from PIN_Dev.
 * @retval None
 */
void adc_init(ADC_TypeDef* ADCx, PIN_Dev pin);

/**
 * @brief  ADC initialize.
 * @param  ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
 * @param  ADC_Channel: the ADC channel to configure.
 *         This parameter can be one of the following values:
 *         @arg from ADC_Channel_0 to ADC_Channel_18
 * @retval None
 */
uint16_t adc_read(ADC_TypeDef* ADCx, uint8_t ch);

#endif /* ADC_INIT_H */
